<template>
  <section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="query">
				<el-form-item>
					<el-input v-model="query.keyword" placeholder="关键字"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" v-on:click="search">查询</el-button>
				</el-form-item>
			</el-form>
		</el-col>

    <!--列表-->
    <el-table :data="pageInfo.rows" highlight-current-row v-loading="listLoading"  style="width: 100%;">
      <el-table-column type="index" width="60">
      </el-table-column>
      <el-table-column prop="name" label="名字" width="120">
      </el-table-column>
      <el-table-column prop="url" label="URL" width="150">
      </el-table-column>
      <el-table-column prop="descs" label="描述" width="150">
      </el-table-column>
      <el-table-column prop="sn" label="SN" width="300">
      </el-table-column>
      <el-table-column prop="parent.name" label="父权限" min-width="80">
      </el-table-column>
    </el-table>

    <!--工具条-->
    <el-col :span="24" class="toolbar">
<!--      <el-pagination-->
<!--          layout="total, prev, pager, next"-->
<!--          @current-change="handleCurrentChange"-->
<!--          :page-size="10"-->
<!--          :total="pageInfo.total"-->
<!--          style="float:right;">-->
<!--      </el-pagination>-->
      <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="query.currentPage"
          :page-sizes="[10, 20, 30, 50]"
          :page-size="query.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="pageInfo.total" style="float:right;">
      </el-pagination>
    </el-col>

	</section>
</template>


<script>
	import util from '../../common/js/util'
	//import NProgress from 'nprogress'
	import { getUserListPage, removeUser, batchRemoveUser, editUser, addUser } from '../../api/api';

	export default {
		data() {
			return {
        employees:[],
        depts:[],
        deptTree:[],
        // emp:[],
        // dep:[],

				filters: {
					name: ''
				},
        pageInfo:{
          total:0,
          rows:[]
        },
        query:{
          currentPage:1,
          pageSize:10,
          keyword:""
        },
				users: [],
				listLoading: false,
				sels: [],//列表选中列
        imageUrl: "",


				addFormVisible: false,//新增界面是否显示
				addLoading: false,
				addFormRules: {
					username: [
						{ required: true, message: '请输入姓名', trigger: 'blur' }
					]
				},

        }


		},
		methods: {
      
		  search(){
        this.query.currentPage = 1;
        this.getPermission()
      },

      handleCurrentChange(val) {
        this.query.currentPage = val;
        this.getPermission()
      },

      handleSizeChange(val){
        this.query.pageSize=val;
        this.getPermission()
      },

      getPermission(){
        this.$http.post("/permission",this.query)
            .then(result => {
              console.log(result);
              result = result.data;
              console.log(result)
              this.pageInfo = result.data;
            }).catch(result => {
          this.$message({ message: '权限分页查询失败',type: 'error'});
        })
      },

		},
		mounted() {
      this.getPermission()
		}
	}

</script>

<style scoped>

</style>